package aom.example.security.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author Xiongx
 * @version 1.0
 * @date 2021/6/6 0:05
 * @since JDK 1.8
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("数据库基础bean")
public class DataBase {

    @TableLogic()
    @TableField(value = "deleted",fill = FieldFill.INSERT)
    @ApiModelProperty("逻辑删除")
    private Integer deleteStatus;

    @ApiModelProperty("创建时间")
//    @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "createtime",fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "updatetime",fill = FieldFill.UPDATE)
    private Date updateTime;

    @Version//乐观锁Version注解
    @ApiModelProperty("乐观锁")
    @TableField(value = "version",fill = FieldFill.INSERT)
    private Integer version;
}
